package org.young.admin;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author lmhd-emp
 * @date 2021/4/26 14:05
 * @description:
 */
@Slf4j
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class , MybatisAutoConfiguration.class})
@ComponentScan(basePackages = { "org.young" })
public class YoungAdminApplication {

	public static void main(String[] args) throws UnknownHostException {
		ApplicationContext applicationContext = SpringApplication.run(YoungAdminApplication.class, args);
		Environment environment = applicationContext.getEnvironment();
		String ip = InetAddress.getLocalHost().getHostAddress();
		String port = environment.getProperty("server.port");
		log.info("\n----------------------------------------------------------\n\t" +
				"Application Young-Boot is running! Access URLs:\n\t" +
				"Local: \t\thttp://localhost:" + port + "/\n\t" +
				"External: \thttp://" + ip + ":" + port + "/\n\t" +
				"Swagger文档: \thttp://" + ip + ":" + port + "/doc.html\n" +
				"----------------------------------------------------------");
	}
}
